package com.liruo.treasureattic.authserver;

import com.liruo.treasureattic.commmon.constant.NameConstant;
import com.liruo.treasureattic.common.config.JacksonConfig;
import com.liruo.treasureattic.common.config.RedissonConfig;
import com.liruo.treasureattic.common.config.properties.JwtProperties;
import com.liruo.treasureattic.common.config.properties.RedisProperties;
import com.liruo.treasureattic.common.errhandler.TraceHolder;
import com.liruo.treasureattic.common.errhandler.handler.GlobalExceptionHandler;
import com.liruo.treasureattic.service.api.client.UserClient;
import com.liruo.treasureattic.service.api.config.DefaultConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Import;

@SpringBootApplication
@ImportAutoConfiguration(classes = {
        JacksonConfig.class,
        RedissonConfig.class
})
@EnableConfigurationProperties(value = {
        JwtProperties.class,
        RedisProperties.class
})
@Import(value = {
        GlobalExceptionHandler.class
})
@EnableFeignClients(
        clients = {
            UserClient.class
        },
        defaultConfiguration = {
            DefaultConfig.class
        }
)
public class AuthServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(AuthServerApplication.class, args);
        TraceHolder.setTrace(NameConstant.AUTH_SERVER);
    }

}
